<template>
  <div class="legal-inpcontent">
    <div class="weui-cell">
      <div class="weui-cell__hd">身份证正面</div>
      <div class="weui-cell__bd" style="text-align: right">
        <van-uploader :after-read="afterRead" />
      </div>
    </div>
    <div class="weui-cell">
      <div class="weui-cell__hd">身份证背面</div>
      <div class="weui-cell__bd" style="text-align: right">
        <van-uploader :after-read="afterRead" />
      </div>
    </div>
    <div class="weui-cell weui-cell-input weui-cell_access">
      <div class="weui-cell__hd">整件类型</div>
      <div class="weui-cell__bd" @click="showPicker = true"><input type="text" placeholder="请选择" readonly></div>
      <div class="weui-cell__ft"></div>
    </div>
    <div class="weui-cell weui-cell-input">
      <div class="weui-cell__hd">姓名</div>
      <div class="weui-cell__bd"><input type="text" placeholder="请输入"></div>
      <div class="weui-cell__ft"></div>
    </div>
    <div class="weui-cell weui-cell-input">
      <div class="weui-cell__hd">证件号码</div>
      <div class="weui-cell__bd"><input type="text" placeholder="请输入"></div>
      <div class="weui-cell__ft"></div>
    </div>
    <div class="weui-cell weui-cell-input weui-cell_access">
      <div class="weui-cell__hd">证件有效期</div>
      <div class="weui-cell__bd" @click="showDatePicker = true"><input type="text" placeholder="请选择" readonly></div>
      <div class="weui-cell__ft"></div>

    </div>
    <div class="default-btnwrap">
      <button type="button" class="default-btn" @click="toNextStep">下一步</button>
    </div>
    <van-popup v-model="showPicker" position="bottom">
      <van-picker
        show-toolbar
        :columns="columns"
        @cancel="showPicker = false"
        @confirm="onConfirmSelectIdCard"
      />
    </van-popup>
    <van-popup v-model="showDatePicker" position="bottom">
          <van-datetime-picker
            v-model="currentDate"
            type="date"
            @confirm="onConfirmSelectDate"
            :min-date="minDate"
            :max-date="maxDate"
          />
    </van-popup>

  </div>
</template>

<script>
  export default {
    name: 'legalPersonInfoStepOne',
    data() {
      return {
        value: '',
        minDate: new Date(1980, 0, 1),
        maxDate: new Date(2025, 10, 1),
        currentDate: new Date(),
        showPicker: false,
        showDatePicker:false,
        columns: ['国内身份证', '国外身份证']
      }
    },
    created(){
      console.log(this.$parent.activeIndex)
    },
    methods:{
      onConfirmSelectIdCard(value) {
        this.value = value;
        this.showPicker = false;
      },
      onConfirmSelectDate(value) {
        //this.value = value;
        this.showDatePicker = false;
      },
      afterRead(file) {
        // 此时可以自行将文件上传至服务器
        console.log(file);
      },
      toNextStep(){
        this.$router.push({
          name:'legalPersonInfoStepTwo'
        })
      }
    }
  }
</script>

<style scoped>

</style>
